import request from "@/utils/request";

enum API {
  C1_URL = "/admin/product/getCategory1",
  C2_URL = "/admin/product/getCategory2/",
  C3_URL = "/admin/product/getCategory3/",
  GETLIST_URL = "/admin/product/attrInfoList/",
  ADDORUPDATE_URL = "/admin/product/saveAttrInfo",
  DELETE_URL = "/admin/product/deleteAttr/",
}
export const reqC1 = () => request.get<any, any>(API.C1_URL);
export const reqC2 = (category1Id: number | string) =>
  request.get<any, any>(API.C2_URL + category1Id);
//三级分类的接口
export const reqC3 = (category2Id: number | string) =>
  request.get<any, any>(API.C3_URL + category2Id);
//获取平台属相与属相值
export const reqList = (
  category1Id: number | string,
  category2Id: number | string,
  category3Id: number | string
) =>
  request.get<any, any>(
    API.GETLIST_URL + `${category1Id}/${category2Id}/${category3Id}`
  );
export const reqAddOrUpdate = (data: any) =>
  request.post(API.ADDORUPDATE_URL, data);
//删除已有的平台属性
export const reqDelete = (attrId: number) =>
  request.delete<any, any>(API.DELETE_URL + attrId);
